<?php

/**
 * Array Stream Class
 * @author ReGeDa
 */
class ArrayStream extends Plugin_Object {

	/**
	 * Check is associate array
	 * @param array $array
	 * @return boolean
	 */
	public static function is_assoc(&$array) {
		return array_keys($array) !== range(0, sizeof($array) - 1);
	}

	/**
	 * Fetch last item in ordered array
	 * @param array $array
	 * @return mixed
	 */
	public static function last(&$array) {
		$c = count($array);
		return $c ? $array[$c - 1] : NULL;
	}
}

// end of file